package com.itcc.service;

import com.itcc.config.SpringConfig;
import com.itcc.exception.MyException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class ExceptionTest {

    @Test
    public void myException(){
    //instanceof  实例判断
        try {
            throw new MyException();
        }catch (MyException myException){
            System.out.println(myException.getMsg());
        }catch (Exception e){
            System.out.println(e.getMessage());
        }

    }
}
